#include <iostream>
#include <string>

using namespace std;

int main(){
    string n;
    int i;

    cin >> n;

    int arr [26] = {0};


    for (i=0;i < n.length();i++){
        arr[n[i] - 'a']++;
    }

    int maxn = 0;
    char re;
    for (i = 0;i < 26;i++){
        if (arr[i] > maxn){
            maxn = arr[i];
            re = i +'a';
        }
    }


    cout <<  re << " ";
    cout << maxn << endl;


    return 0;


}